package com.hww.kafka.provider;

import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.concurrent.ListenableFuture;

/**
 * @Author: Wenwu Huang
 * @Date: 2020/1/3 17:37
 */
@Component
public class KafkaSender {

    @Autowired
    private KafkaTemplate kafkaTemplate;

    public void send() {
        ListenableFuture send = kafkaTemplate.send("hellow", "hellwKafka");
        System.out.println(JSON.toJSONString(send));
    }

}
